package com.osfw.activiti.enums.resource;


import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 流程分享状态
 */
public enum ProcdefShareState {

    DEPT(0, "部门私有"),
    USE(1, "共享使用权限"),
    ALL(2, "共享所有权限");

    private Integer state;
    private String name;

    ProcdefShareState(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    public Integer getState() {
        return state;
    }

    public String getName() {
        return name;
    }


    public static ProcdefShareState getProcdefShareState(Integer state) {
        for (ProcdefShareState stateEnum : values()) {
            if (stateEnum.getState().intValue() == state.intValue()) {
                return stateEnum;
            }
        }
        return null;
    }

    public static Map<Integer, String> getProcdefShareState() {
        HashMap<Integer, String> map = new LinkedHashMap<>();
        for (ProcdefShareState stateEnum : values()) {
            map.put(stateEnum.getState(), stateEnum.getName());
        }
        return map;
    }

}
